<template>
	<view class="container">
		<view class="herder">
			<swiper class="top-img indicators-dot" autoplay circular interval='3000' indicator-color="#D3D3D3"
				indicator-active-color="#3E9CF9" indicator-dots>
				<swiper-item class="swiperItem" v-for="(item,i) in swpierList" :key="i">
					<image style="width: 100%; height: 130px;" :src="item">
				</swiper-item>
			</swiper>
		</view>
		<view>
			<u-grid :border="false" col="5">
				<u-grid-item u-slot v-for="(item,index) in menuList" :key="index" @click="itemType(item)">
					<view>
						<image class="icon" :src="item.icon" mode=""></image>
					</view>
					<text class="grid-text" style="font-weight: 400;font-size: 12px;">{{item.title}}</text>
				</u-grid-item>
			</u-grid>
			<!-- <u-toast ref="uToast" /> -->
		</view>
		<view class="">
			<text style="font-weight: 500;font-size: 20px;">猜你喜欢</text>
			<scroll-view scroll-x="true">
				<view class="live-list">
					<view class="live-item" v-for="(item,index) in boastList" :key="index" @click="itemFm(item)">
						<image class="live-item-image" :src="item.url"></image>
						<view class="live-item-text">{{item.title}}</view>
					</view>
				</view>
			</scroll-view>
		</view>
		<view class="">
			<text style="font-weight: 500;font-size: 20px;">最新资讯</text>
			<scroll-view scroll-y="true">
				<view class="lifo-list">
					<view class="lifo-item" v-for="(item,index) in information" :key="index" @click="itemFm(item)">
						<image class="lifo-item-image" :src="item.url" style="width: 250rpx;height:188rpx;"></image>
						<view class="lifo-item-text">
							<view class="infoText">
								<text>{{item.info}}</text>
							</view>
							<view class="lifoItemData">
								<text style="margin-right: 36rpx;">{{item.time}}</text>
								<image src="../../../static/image/Vector06.png" mode=""
									style="width: 16px;height: 11px;margin-right: 10rpx;"></image>
								<text>{{item.frequency}}次</text>
							</view>
						</view>
					</view>
				</view>
			</scroll-view>

		</view>

	</view>
</template>
<script>
	export default {
		data() {
			return {
				swpierList: [

					"../../../static/image/BANNER.png",
					"../../../static/image/BANNER.png",
				],

				menuList: [{
					title: '直播电视',
					icon: '../../../static/image/Vector01.png',
					url: '../onlineTV/onlineTV'
				}, {
					title: '精彩点播',
					icon: '../../../static/image/Vector02.png',
					url: '../onlineTV/wonderful'
				}, {
					title: '在线广播',
					icon: '../../../static/image/Vector03.png',
					url: '../onlineTV/broadcast'
				}, {
					title: '资讯专栏',
					icon: '../../../static/image/Vector04.png',
					url: ''
				}, {
					title: '活动直播',
					icon: '../../../static/image/Vector05.png',
					url: ''
				}, ],

				boastList: [{
					url: '../../../static/image/video/cctv1.png',
					playUrl: 'http://satellitepull.cnr.cn/live/wxscjtgb/playlist.m3u8',
					title: 'CCTV-1综合'
				}, {
					url: '../../../static/image/video/cctv1.png',
					playUrl: 'http://satellitepull.cnr.cn/live/wxscjtgb/playlist.m3u8',
					title: 'CCTV-1综合'
				}],
				information: [{
					url: '../../../static/image/people/swiper1.jpg',
					info: '四川青川：重管护、重培训、助力茶产业高质量发展,四川青川：重管护、重培训、助力茶产业高质量发展',
					time: '2021-06-02 17:06',
					frequency: '300',
					source: '四川新闻网',
				}, {
					url: '../../../static/image/people/swiper1.jpg',
					info: '信息信息信息信息信息信息,四川青川：重管护、重培训、助力茶产业高质量发展',
					time: '2021-06-02 17:06',
					frequency: '300',
					source: '四川娱乐网',
				}, {
					url: '../../../static/image/people/swiper1.jpg',
					info: '周五周五周五周五',
					time: '2021-06-02 17:06',
					frequency: '300',
					source: '四川八卦网',
				}]
			}
		},
		// 
		methods: {
			itemType(item) {
				if (item.url != '') {
					uni.navigateTo({
						url: item.url,
					})
				}else{
					uni.showToast({
						title: '功能暂未开放',
						icon: 'none',
						duration: 2000
					});
				
				}

			},
			itemFm(item) {
				uni.navigateTo({
					url: `./detailsInfo?item=${encodeURIComponent(JSON.stringify(item))}`,
				})
			},

		}
	}
</script>

<style lang="scss" scoped>
	.container {
		padding: 0 32rpx;

		.text {
			font-weight: 400;
			font-size: 12px;
		}

		// 菜单图标
		.icon {
			width: 80rpx;
			height: 80rpx;
		}

		.herder {

			// 轮播图样式开始
			/deep/.top-img {
				width: 100%;
				height: 130px;

				div {
					border-radius: 8px !important;
				}
			}

			// 轮播图指示器样式
			/deep/.indicators-dot {
				.uni-swiper-dot {
					width: 5px !important;
					height: 5px !important;
				}

				.uni-swiper-dot-active {
					width: 5px !important;
					height: 5px !important;
				}

				/deep/.swiperItem {
					border-radius: 8px;
					text-align: center;

					image {
						height: 130px;
						width: 100%;
					}
				}

			}

		}

		// 猜你喜欢
		.live-list {
			margin: 16rpx 0;
			display: flex;

			.live-item {
				display: flex;
				margin-right: 28upx;
				flex-direction: column;
				justify-content: center;

				.live-item-image {
					width: 164upx;
					height: 128upx;
					background-color: #F0F0F0;
				}

				.live-item-text {
					margin-top: 8upx;
					font-family: PingFang SC;
					font-style: normal;
					font-weight: normal;
					font-size: 24upx;
					line-height: 40upx;
					/* identical to box height */
					text-align: center;
					color: #797F81;
				}
			}
		}

		// 最新资讯
		.lifo-list {
			width: 100%;
			height: 300rpx;
			margin-top: 26rpx;

			.lifo-item {
				width: 100%;
				height: 188rpx;
				display: flex;
				margin-bottom: 20rpx;

				.lifo-item-text {
					width: 418rpx;
					height: 188rpx;
					margin-left: 20rpx;
					font-style: normal;
					font-weight: 700;
					font-size: 16px;
					line-height: 22px;
					text-align: justify;
					display: flex;
					flex-flow: column;
					justify-content: space-between;

					.infoText {
						height: 86rpx;
						overflow: hidden;
						display: -webkit-box;
						-webkit-box-orient: vertical;
						-webkit-line-clamp: 2;
					}

					.lifoItemData {
						font-style: normal;
						font-weight: 400;
						font-size: 12px;
						line-height: 17px;
						color: #9F9F9F;
					}

				}
			}

		}

	}
</style>
